﻿@model mvcForum.Web.ViewModels.SplitViewModel
@using mvcForum.Web.Helpers;
@{
	ViewBag.Title = ForumHelper.GetString("SplitTopic.Title", new { Title = Model.Topic.Title });

	Layout = Url.GetThemeBaseUrl() + "areas/forum/views/shared/forumlayout.cshtml";
}
	<!-- Views/Moderate/Split.aspx -->
	<span class="pull-right muted">@ForumHelper.GetString("CurrentTime", new object[] { DateTime.UtcNow })</span>

	<h2>@ForumHelper.GetString("Split.Heading")</h2>
	<hr />

	<div class="row">
		<div class="col-md-12">
			@using (Html.BeginForm("split", "moderate", FormMethod.Post, new { @class = "form-horizontal" })) {
				@Html.Hidden("ForumId", Model.Forum.Id)
				@Html.Hidden("TopicId", Model.Topic.Id)
				<div class="form-group">
					<label for="OriginalTopicTitle" class="col-lg-2 control-label">@ForumHelper.GetString("Split.OriginalTopicTitle")</label>
					<div class="col-lg-10">
						@Html.TextBoxFor(t => t.OriginalTopicTitle, new { @class = "form-control" })
					</div>
				</div>
				<div class="form-group">
					<label for="NewTopicTitle" class="col-lg-2 control-label">@ForumHelper.GetString("Split.NewTopicTitle")</label>
					<div class="col-lg-10">
						@Html.TextBoxFor(t => t.NewTopicTitle, new { @class = "form-control" })
					</div>
				</div>
				<h4>@ForumHelper.GetString("Split.Select")</h4>
				<table class="table posts">
@foreach (var post in Model.Topic.Posts.OrderBy(p => p.Posted)) {
					<tr>
						<td>
	@if (post.Position != 0) {
							<label>
								<input type="checkbox" name="PostId" value="@post.Id" />
								In new topic
							</label>
	}
							@Html.Partial("MessagePosterPartial", post)
						</td>
						<td>
							<div class="row">
								<div class="col-md-9">
									<h4>@post.Subject</h4>
								</div>
								<div class="col-md-3">
									<p class="text-right muted">@post.Posted.ToLocalDateTime().ToString("F")</p>
								</div>
							</div>
							<hr />
							<div class="row">
								<div class="col-md-12">
									@ForumHelper.ParseContent(post.Body)
								</div>
							</div>
						</td>
					</tr>
}
				</table>
				<div class="form-group">
					<div class="col-lg-offset-2 col-lg-10">
						<button type="submit" class="btn btn-primary">@ForumHelper.GetString("Split.Submit")</button>
					</div>
				</div>
			}
		</div>
	</div>

@if (ForumHelper.Debug) {
<!-- For Selenium Test -->
<div id="forum_moderate_split" style="display: none;"></div>
}